package com.yq.bootrabbitmq.service.impl;

import com.yq.bootrabbitmq.service.SendService;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.UUID;

/**
 * @ClassName SendServiceImpl
 * @Description TODO
 * @Author yaoqiang
 * @Date 2021/11/1 17:01
 * @Version 1.0
 */
@Service
public class SendServiceImpl implements SendService {
    @Resource
    private AmqpTemplate amqpTemplate;

    @Override
    public void directSend() {
        amqpTemplate.convertAndSend("BootDirectExchange","BootRouting", UUID.randomUUID());
        //广播
        amqpTemplate.convertAndSend("BootFanoutExchange","","springBootFanout");
        //交换机名称，routingkey,具体消息
        amqpTemplate.convertAndSend("BootTopicExchange","Boot.txt","springBootTopic");
    }
}
